package com.mz.demo.controller;

import com.mz.demo.entity.vo.AccountPasswordInfoVo;
import com.mz.demo.service.RegisterService;
import com.mz.demo.utils.entity.R;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class RegisterController {

    @Resource
    private RegisterService registerService;

    //1、注册
    @PostMapping("/user/register")
    public R loginByAccountPassword( @RequestBody AccountPasswordInfoVo accountPasswordInfoVo) {

        registerService.loginByAccountPassword(accountPasswordInfoVo);
        return R.ok("注册成功");
    }

    //2、注销
    @DeleteMapping("/user/logout")
    public R logout( Long userId ){

        registerService.logout(userId);
        return R.ok("注销成功");
    }
}
